﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Method
{
    class Program
    {
        static void Main(string[] args)
        {
            //IndexOf();
            //GetBytes("aa我们123abddd");
            //Print();
            //Action();
            //ReferenceExtentions();
            //HelloWorld();
            GameMoves();
        }

        public static void IndexOf()
        {
            string msg = "123!adb";
            int index = msg.IndexOf("!");
            if (index >= 0) msg = msg.Substring(0, index + 1);
            Console.WriteLine("msg=>" + msg);
        }

        public static void GetBytes(string value)
        {
            int length = Encoding.Default.GetBytes(value).Length;
            Console.WriteLine("length=>" + length);
        }

        public static void Print()
        {
            "Grant".ShowItems();
            new[] { "Jeff", "Kristin" }.ShowItems();
            new List<Int32> { 1, 2, 3 }.ShowItems();
        }

        public static void Action()
        {
            Action<Object> b = o => Console.WriteLine(o.GetType());
            b.InvokeAndCatch<NullReferenceException>(null);
        }

        public static void ReferenceExtentions()
        {
            Action a = "Grant".ShowItems;
            a();
        }

        public static void HelloWorld()
        {
            HelloCollection helloCollection = new HelloCollection();
            foreach (var item in helloCollection)
            {
                Console.WriteLine(item);
            }
        }

        public static void GameMoves()
        {
            var game = new GameMoves();
            IEnumerator enumerator = game.Cross();
            while (enumerator.MoveNext())
            {
                enumerator = enumerator.Current as IEnumerator;
            }
        }

    }
}
